ARG BASE=tensorflow/tensorflow:2.6.0-gpu-jupyter
FROM $BASE
RUN sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/mirrors\.aliyun\.com\/ubuntu\//g' /etc/apt/sources.list && \
    sed -i 's/http:\/\/security\.ubuntu\.com\/ubuntu\//http:\/\/mirrors\.aliyun\.com\/ubuntu\//g' /etc/apt/sources.list && apt-get update


RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget tzdata vim \
&& wget -O /tmp/talib.tar.gz http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
RUN tar -zxvf /tmp/talib.tar.gz -C /tmp && cd /tmp/ta-lib && ./configure && make && make install && rm -rf /tmp/talib.tar.gz /tmp/ta-lib

RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ADD ./pip.conf /root/.pip/pip.conf

ENV TINI_VERSION v0.19.0
ADD ./tini /usr/bin/tini
RUN chmod +x /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "--"]


RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir torch==1.10.0+cpu torchvision==0.11.1+cpu torchaudio==0.10.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html && pip install --no-cache-dir xgboost

#COPY install-dep.sh /tmp
COPY requirements.txt /tmp/
#RUN bash /tmp/install-dep.sh $BASE
RUN pip install --no-cache-dir -r /tmp/requirements.txt


ADD ./jupyter_lab_config.py /root/.jupyter/jupyter_lab_config.py
ADD ./.vimrc.simple /root/.vimrc

RUN apt-get install -y sqlite3

CMD ["jupyter", "lab", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--NotebookApp.token=''","--NotebookApp.password='argon2:$argon2id$v=19$m=10240,t=10,p=8$JU2LUpa6iMJHTUVMg8YYTw$q/Bo9mj6P5ABwGtKYSKKrg'","--allow-root"]
